#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : get_pay_mode_id_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/6/21 18:26 
@Describe: 获取支付方式支付ID
"""
from fastapi import APIRouter
from FastApi.dto.pos.orderPay.get_pay_mode_id_dto import GetPayModeIdDtoModel
from FastApi.server.pos.order_pay.pos_order_pay_server import PosOrderPayServer
from Comm.logUtils.logControl import LogHandler

logger = LogHandler().get_logger()
getPayModeId_route = APIRouter()


@getPayModeId_route.post("/pay-mode-id", name="获取支付方式ID")
async def getPayModeId(payload: GetPayModeIdDtoModel):
    logger.info('请求参数:[{}]'.format(payload))
    pos_pay_request = PosOrderPayServer(payload.brandCode, payload.environment)
    pay_mode_id = int(pos_pay_request.get_pay_mode_id())
    response_data = {"code": 200, "message": "请求成功~", "data": pay_mode_id}
    logger.info('接口响应:[{}]'.format(response_data))
    return pay_mode_id
